﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using System.Xml.Serialization;
using System.IO;
using System.Xml;
using System.Diagnostics;
using System.ComponentModel;
using ClassLibrary1.Recursif;

namespace ApplicationTest
{
    class Program
    {
        static void Main(string[] args)
        {

            //Test1();

        }

        private static void Test2()
        {
            List<ClassSource> lst = new List<ClassSource>();
            for (int i = 0; i < 2; i++)
            {
                ClassSource s = new ClassSource() { Property1 = i };
                for (int j = 0; j < 2; j++)
                {
                    ClassTestItemSource t = new ClassTestItemSource() { Parent = s };
                    s.Property2.Add(t);
                }
                lst.Add(s);
            }

            //var o = Automapper.Map(lst);
        }

        //private static void Test1()
        //{
        //    Automapper j = new Automapper();

        //    List<Presentations.Meeting> i = null;

        //    byte[] buffer = Encoding.UTF8.GetBytes(Resource1.turfData);
        //    XmlSerializer x = new XmlSerializer(typeof(List<Presentations.Meeting>), new Type[] { typeof(Presentations.Race), typeof(Presentations.Participant), typeof(Presentations.Horse) });
        //    MemoryStream mem = null;
        //    XmlTextReader r = null;

        //    using (mem = new MemoryStream(buffer))
        //    using (r = new XmlTextReader(mem))
        //        i = (List<Presentations.Meeting>)x.Deserialize(r);

        //    List<Models.Meeting> target = new List<Models.Meeting>();
        //    System.Diagnostics.Stopwatch w = new System.Diagnostics.Stopwatch();
        //    // 1489

        //    w.Start();
        //    for (int m = 0; m < 1000000; m++)
        //    {
        //        foreach (var item in i)
        //        {
        //            var u = Automapper.Map(item);
        //            target.Add(u);
        //        }

        //        //var target2 = Automapper.Map(i);

        //    }
        //    w.Stop();
        //    var o = w.ElapsedMilliseconds / 1000;

        //    //decimal c1 = AutoMapper.CntProperties / 1000;
        //    //decimal c2 = AutoMapper.CntClass / 1000;

        //    //var av1 = (c1 / o);
        //    //var av2 = (c2 / o);

        //    //Debug.WriteLine("{0} : {1} (ratio : {2})", o, c1, av1);
        //    //Debug.WriteLine("{0} : {1} (ratio : {2})", o, c2, av2);
        //}
   
    }



    public class ClassSource1
    {        
        public bool Enable { get; set; }
        public string Name { get; set; }
        public System.ConsoleSpecialKey property3 { get; set; }
        public IEnumerable<ClassSource2> property4 { get; set; }
    }
    public class ClassSource2
    {
        public string Name { get; set; }
    }


    public class ClassTarget1
    {
        [TypeConverter(typeof(ApplicationTest.CBooleanToInt32))]
        public int Enabled { get; set; }
        public string Name { get; set; }
        public System.ConsoleSpecialKey property3Target { get; set; }
        public IEnumerable<ClassTarget2> property4 { get; set; }
    }
    public class ClassTarget2
    {
        public string Name { get; set; }
    }
}
